//
//  GoodsCell.m
//  体育商城
//
//  Created by  on 2022/9/24.
//

#import "GoodsCell.h"
@interface GoodsCell()
@property (strong, nonatomic) IBOutlet UIImageView *img;
@property (strong, nonatomic) IBOutlet UILabel *title;
@property (strong, nonatomic) IBOutlet UILabel *money;
@property (strong, nonatomic) NSURLSessionTask *task;
@end
@implementation GoodsCell
- (void)awakeFromNib{
    [super awakeFromNib];
}
- (void)setModel:(Goods *)model{
    if (_model != model) {
        _model = model;
        if (self.task) {
            [self.task cancel];
        }
        self.img.image = nil;
        self.title.text = model.shortDescription;
        self.money.text = [NSString stringWithFormat:LS(@"¥:%@"),model.price];
        self.task = [UIImage imageWithURL:model.mainImage block:^(UIImage * _Nonnull image) {
            self.img.image = image;
        }];
    }
}
@end
